package algorithm;

public class leetcode_0338 {
    public int[] countBits(int n) {
        int tem;
        int[] result=new int[n+1];
        for(int i=0;i<=n;++i){
            tem=i;
            while(tem!=0){
                result[i]+=tem%2;
                tem=tem>>1;
            }
        }
        return result;
    }
}
